package com.dys.listener;

import javax.servlet.*;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 * @Author: 疾风
 * @ClassName: MySessionListener
 * @Description: Session监听器
 * @CreateDate: 2024/09/25
 * @Version: v1.0.0
 */
@WebListener
public class MyApplicationListener implements ServletContextListener, ServletContextAttributeListener {
    @Override
    public void attributeAdded(ServletContextAttributeEvent scae) {
        System.out.println("向Application对象中添加了数据");
    }

    @Override
    public void attributeRemoved(ServletContextAttributeEvent scae) {
        System.out.println("向Application对象中移除了数据");
    }

    @Override
    public void attributeReplaced(ServletContextAttributeEvent scae) {
        System.out.println("向Application对象中修改了数据");
    }

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("任何一个Application对象的创建");
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("任何一个Application对象的销毁");
    }
}
